package com.jingming.consult.videoplayer;

import android.media.MediaPlayer;

/**
 * 音频播放器管理器.
 */
public class FrequencyPlayerManager {

    private MediaPlayer mMediaPlayer;

    private FrequencyPlayerManager() {
    }

    private int mId;
    private String titel;
    private String nickname;
    private int nextId;

    public int getNextId() {
        return nextId;
    }

    public void setNextId(int nextId) {
        this.nextId = nextId;
    }

    public String getTitel() {
        return titel;
    }

    public void setTitel(String titel) {
        this.titel = titel;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    private static FrequencyPlayerManager sInstance;

    public static synchronized FrequencyPlayerManager instance() {
        if (sInstance == null) {
            sInstance = new FrequencyPlayerManager();
        }
        return sInstance;
    }

    public MediaPlayer getCurrentFrequencyPlayer() {
        return mMediaPlayer;

    }

    public void setCurrentFrequencyPlayer(MediaPlayer mediaPlayer) {
        if (mMediaPlayer != mediaPlayer) {
            releaseFrequencyPlayer();
            mMediaPlayer = mediaPlayer;
        }
    }

    public void setNewsId(int id) {
        if (mId != id) {
            mId = id;
        }
    }

    public int getNewsId() {
        return mId;

    }

    public void releaseFrequencyPlayer() {
        if (mMediaPlayer != null) {
            mMediaPlayer.release();
            mMediaPlayer = null;
        }
    }


}
